<?php


namespace app\pushnotify\controller;


use think\Controller;
use think\Log;

/**
 * 华为推送回执信息类 //huawei=>5 xiaomi=>4 vivo=>3 oppo=>2 极光=> 1
 * Class Huawei
 * @package app\pushnotify\controller
 */
class Huawei extends Controller
{
    public function index()
    {
        if ($this->request->isPost())
        {
            $data = $this->request->param();
            foreach ($data['statuses'] as $item)
            {
                if ($item['biTag'])
                {
                    [$thingType, $pushId] = explode('_', $item['biTag']);

                    $d = [
                        'thing_type' => $thingType,
                        'push_id' => $pushId,
                        'requestId' => $item['requestId'],
                        'status' => $item['status'],
                        'regid' => $item['token'],
                    ];
                    // 记录日志
                    Log::write($d, '5_flog_push_return', true);
                }
            }
        }
    }
}
